package cn.javass.dp.strategy.mydemo4;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 *
 * 使用spring初始化注入service 实现InitializingBean
 * <p><em>Created on 2021/2/1 14:31</em></p>
 *
 * @author x
 * @since 1.0.1
 */

public class MessageServiceStrategyFactory {

    private static Map<String,MessageService> services = new ConcurrentHashMap<String,MessageService>();

    public  static MessageService getMessageType(String type){
        return services.get(type);
    }

    public static void register(String userType,MessageService messageService){
        services.put(userType,messageService);
    }
}
